package pATT.profile;

import java.util.Vector;

public class ComponentLeaf extends ComponentTree {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private double valueExist = 0;
	private double valueNotExist = 0;
	protected String valueAtt = "";
	
	public ComponentLeaf(String nameAttribute, String valueAttribute, double valueExist, double valueNotExist) {
		super(nameAttribute);
		this.valueAtt = valueAttribute;
		this.valueExist = valueExist;
		this.valueNotExist = valueNotExist;
	}

	@Override
	public ComponentTree appliesTo(Vector situation) {
//		if(getValueAtt(situation).equals(valueAtt)){
//			return this;
//		}
//		return null;
		return this;
	}

	public double getValueExist() {
		return valueExist;
	}

	public double getValueNotExist() {
		return valueNotExist;
	}

	@Override
	public StringBuffer toText() {
//		StringBuffer text = new StringBuffer(nameAtt+" = "+valueAtt+"["+valueExist+"-"+valueNotExist+"]");
		String text = " [Component='Leaf' name='"+nameAtt+"' value='"+valueAtt+"' ("+
				getValueExist()+"/"+getValueNotExist()+")] ";
		
		
		return new StringBuffer(text);
	}

	public String getValueAtt() {
		return valueAtt;
	}

}
